package com.ssy.lingxi.order.entity;

import com.fasterxml.jackson.annotation.JsonManagedReference;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 *  送货单-物料信息-实体
 * @author ds
 * @date 2022/3/23
 * @version 2.0.0
 */
@Entity
@Table(schema = "public", name = "ord_delivery_order_product",
        indexes = {@Index(name = "ord_delivery_order_product_order_product_id_idx", columnList = "orderProductId"),
                @Index(name = "ord_delivery_order_product_delivery_order_id_idx", columnList = "delivery_order_id")})
public class DeliveryOrderProductDO implements Serializable {

    private static final long serialVersionUID = 5883379664030252563L;
    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_delivery_order_product_seq")
    @SequenceGenerator(sequenceName = "ord_delivery_order_product_seq", name = "ord_delivery_order_product_seq", allocationSize = 1)
    private Long id;

    /**
     * 发货通知单
     */
    @JsonManagedReference
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "delivery_order_id", referencedColumnName = "id")
    private DeliveryOrderDO deliveryOrder;

    /**
     * 商品skuId/物料编号
     */
    @Column(columnDefinition = "varchar(16)")
    private String skuId;

    /**
     * 订单记录id
     */
    @Column
    private Long orderProductId;

    /**
     * 商品名称/物料名称
     */
    @Column(columnDefinition = "varchar(255)")
    private String productName;

    /**
     * 规格型号
     */
    @Column(columnDefinition = "varchar(40)")
    private String type;

    /**
     * 品类
     */
    @Column(columnDefinition = "varchar(16)")
    private String category;

    /**
     * 品牌
     */
    @Column(columnDefinition = "varchar(20)")
    private String brand;

    /**
     * 单位
     */
    @Column(columnDefinition = "varchar(16)")
    private String unit;

    /**
     * 订单编号
     */
    @Column(columnDefinition = "varchar(16)")
    private String orderNo;

    /**
     * 下单时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime createTime;

    /**
     * 采购数量
     */
    @Column(columnDefinition = "decimal")
    private BigDecimal purchaseCount;

    /**
     * 发货数量
     */
    @Column(columnDefinition = "decimal")
    private BigDecimal deliveryCount;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public DeliveryOrderDO getDeliveryOrder() {
        return deliveryOrder;
    }

    public void setDeliveryOrder(DeliveryOrderDO deliveryOrder) {
        this.deliveryOrder = deliveryOrder;
    }

    public String getSkuId() {
        return skuId;
    }

    public void setSkuId(String skuId) {
        this.skuId = skuId;
    }

    public Long getOrderProductId() {
        return orderProductId;
    }

    public void setOrderProductId(Long orderProductId) {
        this.orderProductId = orderProductId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public BigDecimal getPurchaseCount() {
        return purchaseCount;
    }

    public void setPurchaseCount(BigDecimal purchaseCount) {
        this.purchaseCount = purchaseCount;
    }

    public BigDecimal getDeliveryCount() {
        return deliveryCount;
    }

    public void setDeliveryCount(BigDecimal deliveryCount) {
        this.deliveryCount = deliveryCount;
    }
}
